//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//********************************************************* 

using Microsoft.TridentWordAddIn.Common;

namespace Microsoft.TridentWordAddIn.Presentation
{
    /// <summary>
    /// The command to be invoked by the Dashbaord button in the ribbon
    /// </summary>
    public class DashboardCommand : RibbonCommand
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DashboardCommand"/> class.
        /// </summary>
        /// <param name="controller">The controller.</param>
        public DashboardCommand(IController controller)
            : base(controller)
        {
        }

        /// <summary>
        /// Gets a value indicating whether the originating control needs to be invalidated.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if the control needs to be invalidated; otherwise, <c>false</c>.
        /// </value>
        public override bool NeedsInvalidate
        {
            get
            {
                return true; // since the toggle action can get canceled, we need to requery always.
            }
        }

        /// <summary>
        /// Invokes the command assuming the toggle buttin is pressed
        /// </summary>
        /// <param name="controlId">The originating control id.</param>
        public override void Invoke(string controlId)
        {
            this.Invoke(true);
        }

        /// <summary>
        /// Invokes the command.
        /// </summary>
        /// <param name="isPressed">if set to <c>true</c> toggle button is pressed.</param>
        public override void Invoke(bool isPressed)
        {
            base.ShowTaskPane(TaskPaneKey.Dashboard, isPressed);
        }
    }
}
